<body>
    <input type="text">
    <ul></ul>
    <script src="ajax.js"></script>
    <script>
        let inpObj = document.querySelector('input');
        let timer = null;
        inpObj.oninput = function () {
        console.log(1)
        if (timer) return
        timer = setTimeout(() => {

        get(   'https://www.baidu.com/sugrec',
                // `prod=pc&wd=${this.value}`,
                {prod:'pc',wd:`${this.value}`},
               (res)=>{document.querySelector('ul').innerText = "";  
                    if (!res.g) return 0;   
                    res.g.forEach((item, i) => {
                        let liObj = document.createElement('li');
                        liObj.innerText = item.q;
                        document.querySelector('ul').appendChild(liObj);
                    })},
                'json',
                ""
            )
            }, 1000);
        }
    </script>
</body>

</html>